<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ page import="com.it.dao.MessageDao"%>
<%@ page import="com.it.bean.Message"%>
<%@ page import="java.util.List"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>内容</title>
<style type="text/css">
body {
	background-color: yellow;
}

.top {
	margin-top: 20px;
}
</style>
<link href="css/bootstrap.min.css" rel="stylesheet" type="text/css">
</head>
<body>
	<%
		MessageDao messageDao = new MessageDao();
		List<Message> messages = messageDao.getAll();
		request.setAttribute("messages", messages);
	%>
	<div class="container top">
		<p>欢迎【${sessionScope.user.userName}】进入简易留言本后台管理系统</p>
		<table class="table table-condensed table-bordered table-hover">
			<caption>留言列表</caption>
			<thead>
				<tr>
					<th>序号</th>
					<th>姓名</th>
					<th>标题</th>
					<th>联系方式</th>
					<th>发布时间</th>
					<th>审核</th>
					<th>删除</th>
				</tr>
			</thead>
			<tbody>
				<c:forEach items="${requestScope.messages }" var="msg"
					varStatus="status">
					<tr>
						<td>${status.index+1 }</td>
						<td>${msg.nickname }</td>
						<td><a href="message.jsp?id=${msg.id}">${msg.title }</a></td>
						<td>${msg.phone }</td>
						<td>${msg.createTime }</td>
						<td><a>审核</a></td>
						<td><a href="deleteMessage?id=${msg.id}">删除</a></td>
					</tr>
				</c:forEach>
			</tbody>
		</table>
		<div class="col-md-4 col-md-offset-4">
			<ul class="pagination">
				<li><a href="#">&laquo;</a></li>
				<li class="active"><a href="#">首页</a></li>
				<li><a href="#">上一页</a></li>
				<li><a href="#">下一页</a></li>
				<li><a href="#">尾页</a></li>
				<li><a href="#">&raquo;</a></li>
			</ul>
		</div>
	</div>
</body>
</html>